﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZF.BLL;
using GCELibrary.Current;
using System.Web.UI.HtmlControls;
using ZF.Model;
using System.Transactions;
using ZF.WS.UserControls;
namespace ZF.WS
{


    //[ModulePage(ModuleType = ModuleType.PosManage)]
    public partial class HousePub : BLL.Page.PageBase, IHouseEditPage
    {
        /// <summary>
        /// 当前页面的操作行为
        /// </summary>
        [PageArgument(Key = "ot", DefaultValue = PageOperType.AddNew)]
        public override PageOperType OperType { get; set; }

        [PageArgument(Key = "hid", CanNull = false, BindOperType = PageOperType.Edit)]
        public int HouseId { get; set; }

        [PageArgument(Key = "dt", DefaultValue = 1, BindOperType = PageOperType.AddNew)]
        public int DealType { get; set; }

        public string Type { get; set; }

        public virtual HouseEdit HouseEdit { get { return this.HouseEdit1; } }
        
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (!IsPostBack)
            {
                if (this.OperType == PageOperType.AddNew)
                {
                    if (!(this.DealType >= 1 && this.DealType <= 4))
                    {
                        throw WarnFactory.CreateWarn(WarnCode.ParameterError);
                    }
                    HouseEdit.Add();

                }
                else if (this.OperType == PageOperType.Edit)
                    HouseEdit.Edit();
            }
        }
 

    }

    public interface IHouseEditPage
    {
        /// <summary>
        /// 当前页面的操作行为
        /// </summary>
        [PageArgument(Key = "ot", DefaultValue = PageOperType.AddNew)]
        PageOperType OperType { get; set; }

        [PageArgument(Key = "hid", CanNull = false, BindOperType = PageOperType.Edit)]
        int HouseId { get; set; }

        [PageArgument(Key = "dt", DefaultValue = 1, BindOperType = PageOperType.AddNew)]
        int DealType { get; set; }

        string Type { get; set; }
    }



}
